<template>
  <div id="app">
    <el-container>
      <el-header class="simple-header">
        <div class="logo">区块链溯源系统</div>
        <el-menu
          :default-active="activeIndex"
          class="el-menu-demo"
          mode="horizontal"
          router
          background-color="#fff"
          text-color="#333"
          active-text-color="#409EFF">
          <el-menu-item index="/">首页</el-menu-item>
          <el-menu-item index="/goods">商品管理</el-menu-item>
          <el-menu-item index="/transaction-chain">区块链交易链路</el-menu-item>
          <el-menu-item index="/accounts">账户管理</el-menu-item>
        </el-menu>
      </el-header>
      
      <el-main class="simple-main">
        <tech-loading :loading="isLoading"></tech-loading>
        <router-view @loading-start="startLoading" @loading-end="endLoading"/>
      </el-main>
      
      <el-footer class="simple-footer">
        <div class="footer-content">
          <div class="footer-left">
            <p>区块链商品溯源系统 &copy; {{ new Date().getFullYear() }}</p>
          </div>
          <div class="footer-right">
            <p>基于FISCO BCOS & WeBASE-Front</p>
          </div>
        </div>
      </el-footer>
    </el-container>
  </div>
</template>

<script>
import TechLoading from './components/TechLoading.vue'

export default {
  name: 'App',
  components: {
    TechLoading
  },
  data() {
    return {
      activeIndex: this.$route.path,
      isLoading: false
    }
  },
  watch: {
    $route(to) {
      this.activeIndex = to.path
    }
  },
  methods: {
    startLoading() {
      this.isLoading = true
    },
    endLoading() {
      this.isLoading = false
    }
  }
}
</script>

<style>
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap');

:root {
  --primary-color: #409EFF;
  --secondary-color: #606266;
  --success-color: #67C23A;
  --warning-color: #E6A23C;
  --danger-color: #F56C6C;
  --border-radius: 4px;
  --box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
}

body {
  margin: 0;
  background-color: #f5f7fa;
  font-family: 'Roboto', sans-serif;
}

#app {
  font-family: 'Roboto', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #2c3e50;
  height: 100vh;
}

.simple-header {
  background-color: #fff;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: auto !important;
}

.logo {
  font-size: 18px;
  font-weight: bold;
  color: #409EFF;
}

.simple-main {
  background-color: #f5f7fa;
  padding: 20px;
}

.simple-footer {
  background-color: #fff;
  color: #606266;
  padding: 20px;
  box-shadow: 0 -2px 12px 0 rgba(0, 0, 0, 0.1);
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-left, .footer-right {
  font-size: 0.85rem;
}

/* 基本元素UI样式 */
.el-card {
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  margin-bottom: 20px;
}

/* 全局对话框样式 */
.el-dialog__wrapper {
  position: fixed !important;
}

.v-modal {
  position: fixed !important;
}

/* 解决嵌套弹窗样式问题 */
.el-select-dropdown {
  z-index: 3000 !important;
}

.el-message {
  z-index: 3100 !important;
}

.el-message-box__wrapper {
  z-index: 3200 !important;
}

.el-loading-mask {
  z-index: 2900 !important;
}

/* 添加一些平滑过渡 */
.fade-enter-active, .fade-leave-active {
  transition: opacity 0.3s ease;
}
.fade-enter, .fade-leave-to {
  opacity: 0;
}
</style> 